<{include file="public/member_header" /}>
<link rel="stylesheet" href="__STATIC__/assets/css/filter.min.css">
<style>
	.media_name_url{position:relative;display:inline-block;}
	.media_name_url:hover.refresh_span{display:block;}
	.media_name_url .refresh_span{position:absolute;bottom:-35px;display:none;left:0;width:150px;line-height:35px;background:#ffffff;padding-left:10px;border:1px solid #eee; z-index:1111;}
	.media_name_url .refresh_span .refresh_btn{cursor:pointer;margin-left:5px;color:#0e90d2;}
	.layui-table-cell{overflow: inherit!important;}
</style>
<div class="am-cf admin-main">
  <!-- sidebar start -->
  <{include file="public/member_main" /}>
  <!-- sidebar end -->
  <!-- content start -->
  <div class="admin-content"> 
   <div class="admin-content-body">
    <div class="am-cf am-padding am-padding-bottom-0">
     <div class="am-fl am-cf"> 
      <strong class="am-text-warning am-text-lg">媒体价格</strong>
     </div>
    </div>
    <hr />
    <div class="am-g">
     <div class="am-u-sm-12"> 
      <div class="filter" id="filter"> 
       <div class="filter-item filter-clear"> 
        <div class="filter-label">
         平台：
        </div> 
        <ul class="filter-list filter-clear" id="MediaWebNameID"> 
         <li class="filter-option sx active" data="0">所有</li> <{volist name="MediaWebNameID" id="val"}> 
         <li class="filter-option sx" data="<{$val.TypeID}>"><{$val.TypeName}></li> <{/volist}> 
        </ul> 
       </div> 
       <div class="filter-item filter-clear"> 
        <div class="filter-label">
         行业分类：
        </div> 
        <ul class="filter-list filter-clear" id="MediaIndustryID">
         <li class="filter-option sx active" data="0">所有</li> <{volist name="MediaIndustryID" id="val"}>
         <li class="filter-option sx" data="<{$val.TypeID}>"><{$val.TypeName}></li> <{/volist}> 
        </ul> 
       </div> 
       <div class="filter-item filter-clear"> 
        <div class="filter-label">
         地区：
        </div> 
        <ul class="filter-list filter-clear" id="MediaCityID"> 
         <li class="filter-option sx active" data="0">所有</li> <{volist name="MediaCityID" id="val"}> 
         <li class="filter-option sx" data="<{$val.TypeID}>"><{$val.TypeName}></li> <{/volist}> 
        </ul> 
       </div> 
       <div class="filter-item filter-clear"> 
        <div class="filter-label">
         链接类型：
        </div> 
        <ul class="filter-list filter-clear" id="MediaUrlTypeID"> 
         <li class="filter-option sx active" data="0">所有</li> <{volist name="MediaUrlTypeID" id="val"}> 
         <li class="filter-option sx" data="<{$val.TypeID}>"><{$val.TypeName}></li> <{/volist}> 
        </ul> 
       </div>
       <div class="filter-item filter-clear"> 
        <div class="filter-label">
         发稿速度：
        </div> 
        <ul class="filter-list filter-clear" id="MediaSpeedID"> 
         <li class="filter-option sx active" data="0">所有</li> <{volist name="MediaSpeedID" id="val"}> 
         <li class="filter-option sx" data="<{$val.TypeID}>"><{$val.TypeName}></li> <{/volist}> 
        </ul> 
       </div> 
       <div class="filter-item filter-clear"> 
        <div class="filter-label">
         新闻源：
        </div> 
        <ul class="filter-list filter-clear" id="MediaNewsSourceID"> 
         <li class="filter-option sx active" data="0">所有</li> <{volist name="MediaNewsSourceID" id="val"}> 
         <li class="filter-option sx" data="<{$val.TypeID}>"><{$val.TypeName}></li> <{/volist}> 
        </ul> 
       </div> 
       <div class="filter-item filter-clear"> 
        <div class="filter-label">
         周末可发：
        </div> 
        <ul class="filter-list filter-clear" id="MediaCanSendID"> 
         <li class="filter-option sx active" data="0">所有</li> <{volist name="MediaCanSendID" id="val"}> 
         <li class="filter-option sx" data="<{$val.TypeID}>"><{$val.TypeName}></li> <{/volist}> 
        </ul> 
       </div> 
       <div class="filter-item filter-clear"> 
        <div class="filter-label">
         特殊行业：
        </div> 
        <ul class="filter-list filter-clear" id="MediaSpecialIndustryID"> 
         <li class="filter-option sx active" data="0">不限</li> <{volist name="MediaSpecialIndustryID" id="val"}> 
         <li class="filter-option sx" data="<{$val.TypeID}>"><{$val.TypeName}></li> <{/volist}> 
        </ul> 
       </div> 
       <div class="filter-item filter-clear"> 
        <div class="filter-label">
         收录情况：
        </div> 
        <ul class="filter-list filter-clear" id="MediaSituationID"> 
         <li class="filter-option sx active" data="0">不限</li> 
		 <{volist name="MediaSituationID" id="val"}> 
         <li id="sltip" class="filter-option sx" data="<{$val.TypeID}>" 
		 <{if condition="$val.TypeID eq 86"}> title="包收录的媒体,若稿件未收录,请在第二个工作日下班前提交反馈,<br>有特殊要求的媒体请按照媒体备注操作<br>(例:周五出的稿件,在周六日非正常工作日的情况下,最晚周一下班前反馈未收录)"<{/if}>><{$val.TypeName}></li> <{/volist}> 
        </ul> 
       </div> 
       <div class="filter-item filter-clear"> 
        <div class="filter-label">
         入口级别：
        </div> 
        <ul class="filter-list filter-clear" id="MediaInLevelID"> 
         <li class="filter-option sx active" data="0">不限</li> <{volist name="MediaInLevelID" id="val"}> 
         <li class="filter-option sx" data="<{$val.TypeID}>"><{$val.TypeName}></li> <{/volist}> 
        </ul> 
       </div> 
       <div class="filter-item filter-clear"> 
        <div class="filter-label">
         价格分类：
        </div> 
        <ul class="filter-list filter-clear" id="MediaPrice"> 
         <li class="filter-option sx active" data="0">不限</li> <{volist name="MediaPrice" id="val"}> 
         <li class="filter-option sx" data="<{$key}>"><{$val}></li> <{/volist}> 
        </ul> 
       </div>
	    <!--<div class="filter-item filter-clear">
			<div class="filter-label">节日栏目<!--春节可发：</div>
			<ul class="filter-list filter-clear" id="yearstate">
				<li class="filter-option sx active" data="0">不限</li>
				<li class="filter-option sx" data="1" style="color: red">国庆可发<!--春节可发-<img style="vertical-align: top; margin-left: 2px;" src="__STATIC__/img/icon_new.gif"></li>
			</ul>
		</div>
		--->
       <div class="filter-item filter-clear"> 
        <div class="filter-label">
         排序：
        </div> 
		<ul class="filter-list filter-clear" id="OrderWay">
			<li class="filter-option sx active" data="">默认</li>
			<li class="filter-option sx" id="priceor" data="1">价格<i class="am-icon-sort"></i></li>
			<li class="filter-option sx" id="fensior" data="2" >出稿率<i class="am-icon-sort"></i></li>
			<li class="filter-option sx" id="fensior" data="3" >电脑权重<i class="am-icon-sort"></i></li>
			<li class="filter-option sx" id="fensior" data="4" >移动权重<i class="am-icon-sort"></i></li>
		</ul>
       </div>
      </div>
	  <!--检索开始---> 
       <div class="am-margin-bottom-xs am-margin-top"> 
        <div class="am-u-sm-6">
		<button type="button" style="margin-right: 10px;" id="status_change" class="am-btn am-btn-primary am-btn-sm">查看全部</button>
		<button type="button" class="am-btn am-btn-danger am-btn-sm todayjia">今日新增</button> 
         <a href="<{:url('resource/add')}>" class="am-btn am-btn-secondary am-btn-sm">媒体入驻</a> 
         <a id='exportbutton' onclick="ExportExcel('<{:url('media/exportexcel')}>');" href="javascript: void (0)" class="am-btn am-btn-success am-btn-sm">导出</a>
		 <button type="button" class="am-btn am-btn-warning am-btn-sm collectlist">收藏夹</button> 
        </div> 
        <div class="am-u-md-5"> 
         <form class="am-form am-form-horizontal"> 
          <div class="am-form-group am-margin-bottom-0"> 
		   <label class="am-form-label am-u-sm-3" for="search_media">备注：</label> 
		   <div class="am-u-sm-7 am-padding-horizontal-xs"> 
			<input name="MediaContent" id="keybz" type="text" placeholder="请输入备注" autocomplete="off" style="height: 32px" /> 
		   </div>
           <label class="am-form-label am-u-sm-3" for="search_media">媒体名称：</label> 
           <div class="am-u-sm-7 am-padding-horizontal-xs"> 
            <input name="media_name" id="keyw" type="text" placeholder="请输入媒体名称" autocomplete="off" style="height: 32px" /> 
           </div> 
           <div class="am-u-sm-2 "> 
            <button type="button" id="searchbtn" class="am-btn am-btn-sm am-btn-primary">搜索</button> 
           </div> 
          </div> 
         </form> 
        </div> 
       </div> 
       <!--检索结束---> 
     </div> 
	  
     <div class="am-g"> 
      <div class="am-u-sm-12"> 
       <div id="my_article_wrapper" class="dataTables_wrapper no-footer"> 
        <input type="hidden" id="where" value="" /> 
        <input type="hidden" id="collect" value="" /> 
		<input type="hidden" id="todayjia" value="" /> 
        <div class="table-list table-list2" id="result" style="padding:1.5rem;"> 
         <table class="layui-hide" id="showing" lay-filter="showing"></table> 
        </div> 
        <div class="clear"></div>
       </div> 
      </div> 
     </div>
    </div>
   </div>
  </div>
<{include file="public/member_footer" /}>
<link rel="stylesheet" href="__STATIC__/lib/layui/css/layui.css" />
<script type="text/javascript" src="__STATIC__/lib/layui/layui.js"></script>
<script>
  /**
   导出Excel
  */
    function ExportExcel(Url){
        var where=$('#where').val();
        var collect=$('#collect').val();
        var key=$('#keyw').val();
		var keybz=$('#keybz').val();
        var UrlStr=Url+'?where='+where+'&collect='+collect+'&media_name='+key+'&MediaContent='+keybz;
        location.href=UrlStr
    }
    layui.use(['table','form'], function(){
    var table = layui.table,form = layui.form;
    //var documentWidth=$(document).width();
    //第一个实例
    table.render({
        elem: '#showing',
        url: '<{:url("media/getlist")}>'
        //接口的其他参数
        ,
        where: {
            is_freeze: '0'
        },
        page: true //开启分页
        ,
        limit: 20,
        cols: [[ //表头
        {
            field: 'pdlx',
            align: 'center',
            title: '频道类型',
            width: '100'
        },
        {
            field: 'MediaTitle',
            align: 'center',
            title: '媒体名称',
            width: '196'
        },
        {
            field: 'price',
            align: 'center',
            title: '价格',
            width: '80'
        },
        {
            field: 'cgl',
            align: 'center',
            title: '出稿率',
            width: '80'
        },
        {
            field: 'dnqz',
            align: 'center',
            title: '电脑权重',
            width: '100',
            templet: '#pc_weightTpl'
        },
        {
            field: 'ydqz',
            align: 'center',
            title: '移动权重',
            width: '100',
            templet: '#m_weightTpl'
        },
        {
            field: 'xwy',
            align: 'center',
            title: '新闻源',
            width: '100'
        },
        {
            field: 'link_type',
            align: 'center',
            title: '链接情况',
            width: '120'
        },
        {
            field: 'MediaContent',
            align: 'center',
            title: '备注',
            width: '180'
        },
        {
            field: 'mediaid_checks',
            align: 'center',
            title: '收藏',
            width: '60',
            templet: '#pc_mediagetTpl'
        }]]
    });
});
function update_case_link(id){
	$.ajax({
        type: "POST",
        url: "<{:url('media/caselinks')}>",
        data: {
            id: id
        },
        dataType: "json",
        cache: false,
        success: function(Result) {
            if (Result.code == 200) {
                alert(Result.msg);
            } else {
                alert(Result.msg);
                return false;
            }
        }
    });
	 return false;
}
//筛选
$('#key').blur(function() {
    var key = $("#key").val();
    var where = $("#where").val();
    var arr = where.split(',');
    var id = $(this).parent().attr('id');
    var data = $(this).attr('data');
    var str = '';
    for (var i = 0; i < arr.length; i++) {
        if (arr[i]) {
            var arr2 = arr[i].split('_');
            if (arr2[0] != id) {
                str += arr[i] + ',';
            }
        }
    }
    var string = id + '_' + data + ',';
    if (id == undefined && data == undefined) {
        var string = '';
    }
    $("#where").val(str + '' + string);
    var where = $("#where").val();
    layui.table.reload('showing', {
        url: "<{:url('media/getlist')}>",
        page: 1
        //接口的其他参数
        ,
        where: {
            where: where,
            media_name: key
        }
        //,height: 300
    });
}) 
$('.sx').click(function() {
    $(this).addClass("active").siblings().removeClass("active");
    var key = $("#key").val();
    var where = $("#where").val();
    var arr = where.split(',');
    var id = $(this).parent().attr('id');
    var data = $(this).attr('data');
	if(id === 'OrderWay'){
		var icon = $(this).children('i');
		if(icon.length === 1){
			var cName = icon[0].className;
			if(cName === 'am-icon-sort-desc' || cName === 'am-icon-sort'){
				icon[0].className = 'am-icon-sort-asc';
			   data=data;
			}else if(cName === 'am-icon-sort-asc'){
				icon[0].className = 'am-icon-sort-desc';
				data=(data+1);
			}
		}else{
		  data=(data+0);
		}
		$(this).siblings().children('i').attr("class", "am-icon-sort");
	}else{
	   data=(data);
	}
    var str = '';
    for (var i = 0; i < arr.length; i++) {
        if (arr[i]) {
            var arr2 = arr[i].split('_');
            if (arr2[0] != id) {
                str += arr[i] + ',';
            }
        }
    }
    var string = id + '_' + data + ',';
    if (id == undefined && data == undefined) {
        var string = '';
    }
    $("#where").val(str + '' + string);
    var where = $("#where").val();
    layui.table.reload('showing', {
        url: "<{:url('media/getlist')}>",
        page: 1
        //接口的其他参数
        ,
        where: {
            where: where,
            key: key
        }
        //,height: 300
    });
});
//收藏
function CollectMedia(MediaID) {
    $.ajax({
        type: "POST",
        url: "<{:url('media/collect')}>",
        data: {
            MediaID: MediaID
        },
        dataType: "json",
        cache: false,
        success: function(Result) {
            if (Result.code == 1) {
                layer.msg(Result.msg);
                return false;
            } else if (Result.code == 2) {
                //layer.msg(Result.msg);
                $('.Media' + MediaID).removeClass('ClassStyle2');
                $('.Media' + MediaID).addClass('ClassStyle1');
                return false;
            } else {
                //layer.msg(Result.msg);
                //$('.Media'+MediaID).html('收藏成功');
                $('.Media' + MediaID).removeClass('ClassStyle1');
                $('.Media' + MediaID).addClass('ClassStyle2');
                return false;
            }
        }
    });
}
//收藏夹
$('.collectlist').click(function() {
    $('#collect').val('list');
    $(this).addClass("on").siblings().removeClass("on");
    var key = $("#key").val();
    var where = $("#where").val();
    var arr = where.split(',');
    var id = $(this).parent().attr('id');
    var data = $(this).attr('data');
    var str = '';
    for (var i = 0; i < arr.length; i++) {
        if (arr[i]) {
            var arr2 = arr[i].split('_');
            if (arr2[0] != id) {
                str += arr[i] + ',';
            }
        }
    }
    var string = id + '_' + data + ',';
    if (id == undefined && data == undefined) {
        var string = '';
    }
    $("#where").val(str + '' + string);
    var where = $("#where").val();
    where = where.replace(/undefined/g, '');
    where = where.replace(/-,/g, '');
    layui.table.reload('showing', {
        url: "<{:url('media/getlist')}>"
        //接口的其他参数
        ,
        where: {
            where: where,
            key: key,
            collect: 'list'
        }
        //,height: 300
    });
});
//查看全部媒体
$('#status_change').click(function() {
    $('.sx').removeClass('am-btn-secondary');
    $('.bsx').addClass('am-btn-secondary');
    $('#keyw').val('');
    $('#where').val('');
    $('#collect').val('');
    layui.table.reload('showing', {
        url: "<{:url('media/getlist')}>",
        where: {
            where: '',
            media_name: '',
            collect: ''
        }
    });
});
//搜索按钮
$("#searchbtn").click(function(data) {
    var media_name = $("#keyw").val();
	var MediaContent=$("#keybz").val();
    layui.table.reload('showing', {
        url: "<{:url('media/getlist')}>",
        where: {
            media_name: media_name,
			MediaContent:MediaContent
        }
    });
});

//今日新增
$('.todayjia').click(function() {
    $('#todayjia').val('list');
    $(this).addClass("on").siblings().removeClass("on");
    var key = $("#key").val();
    var where = $("#where").val();
    var arr = where.split(',');
    var id = $(this).parent().attr('id');
    var data = $(this).attr('data');
    var str = '';
    for (var i = 0; i < arr.length; i++) {
        if (arr[i]) {
            var arr2 = arr[i].split('_');
            if (arr2[0] != id) {
                str += arr[i] + ',';
            }
        }
    }
    var string = id + '_' + data + ',';
    if (id == undefined && data == undefined) {
        var string = '';
    }
    $("#where").val(str + '' + string);
    var where = $("#where").val();
    where = where.replace(/undefined/g, '');
    where = where.replace(/-,/g, '');
    layui.table.reload('showing', {
        url: "<{:url('media/getlist')}>"
        //接口的其他参数
        ,
        where: {
            where: where,
            key: key,
            collect: 'todayjia'
        }
    });
});
//鼠标位于 a标签上方时发生 mouseover 事件
$("#sltip").mouseover(function (e) {
	this.Mytitle = this.title;//获取超链接 title属性的内容
	this.title = ""; //设置 title属性内容为空
	$("body").append("<div id='div_toop'>" + this.Mytitle + "</div>");//将要显示的内容添加到 新建 div标签中 并追加到 body 中
	$("#div_toop").css({
			//设置 div 内容位置 
			"top": (e.pageY + 10) + "px",
			"position": "absolute",//添加绝对位置
			"left": (e.pageX + 20) + "px"
		}).show("fast");// show(spe.ed,callback) speed: xian'shi'su'du
}).mouseout(function () { //鼠标指针从 a标签 上离开时 发生mouseout 事件
	this.title = this.Mytitle;
	$("#div_toop").remove();//移除对象
}).mousemove(function (e) { //鼠标指针在 a标签 中移动时 发生mouseout 事件
	$("#div_toop").css({
			//设置 div 内容位置 
			"top": (e.pageY + 10) + "px",
			"position": "absolute",//添加绝对位置
			"left": (e.pageX + 20) + "px"
		});
});
</script>
</body>
</html>